import {
    Navigate,
    useRoutes
} from 'react-router-dom';
import React from 'react';//公共部分不懒加载，在中间页面跳转的部分懒加载，home不懒加载，采用直接引入方式
import Power from './power';

// 内容管理
import AuthorManagement from '../pages/ContentManagement/authorManagement';
import MedalManagement from '../pages/ContentManagement/medalManagement';
import AddMedal from '../pages/ContentManagement/medalManagement/addMedal';
import EditMedal  from '../pages/ContentManagement/medalManagement/editMedal';
import ContentManagement from '../pages/ContentManagement/contentManagement';
import EditContent from "../pages/ContentManagement/contentManagement/editContent";
import AddContent from "../pages/ContentManagement/contentManagement/addContent";
import ContentLabelManagement from "../pages/ContentManagement/contentLabelManagement";

// dl--登录、首页、系统管理
// 懒加载
import Login from '../pages/Login';
import Home from '../pages/Home';
import Shouye from '../pages/Home/shouye';
import SystemManagement from '../pages/SystemManagement/AccountManage';
import RoleManage from '../pages/SystemManagement/RoleManage';
import CreateAccount from '../pages/SystemManagement/AccountManage/createAccount';
import EditAccount from '../pages/SystemManagement/AccountManage/editAccount';
import Person from '../pages/Home/person';
import RolePower from '../pages/SystemManagement/RoleManage/rolePower';
// const SystemManagement = lazy(()=>import('../pages/SystemManagement/AccountManage'));
// const RoleManage = lazy(()=>import('../pages/SystemManagement/RoleManage'));
// const CreateAccount = lazy(()=>import('../pages/SystemManagement/AccountManage/createAccount'));
// const EditAccount = lazy(()=>import('../pages/SystemManagement/AccountManage/editAccount'));
// const Person = lazy(()=>import('../pages/Home/person'));
// const RolePower = lazy(()=>import('../pages/SystemManagement/RoleManage/rolePower'))
// 订单管理
// const Order=lazy(()=>import('../pages/OrderManagement/Order_Ye'));
// const Particulars=lazy(()=>import('../pages/OrderManagement/Particulars'));
import Order from '../pages/OrderManagement/Order_Ye';
import Particulars from '../pages/OrderManagement/Particulars';
// 会员管理
// const MembershipManagement=lazy(()=>import('../pages/MemberManagement/MembershipManagement'));
// const MemberLabelManagement=lazy(()=>import('../pages/MemberManagement/MemberLabelManagement'));
// const CouponManagement=lazy(()=>import('../pages/MemberManagement/couponManagement'));
// const MemberMarketing=lazy(()=>import('../pages/MemberManagement/MemberMarketing'));
import MembershipManagement from '../pages/MemberManagement/MembershipManagement';
import MemberDetails from '../pages/MemberManagement/MemberDetails/index'
import MemberLabelManagement from '../pages/MemberManagement/MemberLabelManagement';
import Newhuiyuan from '../pages/MemberManagement/Newhuiyuan'
import CouponManagement from '../pages/MemberManagement/couponManagement';
import MemberMarketing from '../pages/MemberManagement/MemberMarketing';
import GoDetailM from "../pages/MemberManagement/couponManagement/goDetailM";
import AddCoupon from "../pages/MemberManagement/couponManagement/addCoupon";
import EditCoupon from "../pages/MemberManagement/couponManagement/editCoupon";
import AddMarketing from "../pages/MemberManagement/MemberMarketing/addMarketing"
// 积分商城管理
// const Goods=lazy(()=>import('../pages/PointsMManagement/Goods'));
// const Operate=lazy(()=>import('../pages/PointsMManagement/Operate'));
// const AddGoods=lazy(()=>import('../pages/PointsMManagement/Goods/AddGoods'));
// const EditGoods=lazy(()=>import('../pages/PointsMManagement/Goods/EditGoods'));
// const Mallcategory=lazy(()=>import('../pages/OrderManagement/Mallcategory'));
import Goods from '../pages/PointsMManagement/Goods';
import Operate from '../pages/PointsMManagement/Operate';
import AddGoods from '../pages/PointsMManagement/Goods/AddGoods';
import EditGoods from '../pages/PointsMManagement/Goods/EditGoods'
import Mallcategory from '../pages/OrderManagement/Mallcategory';
import JieZhang from "../pages/FranchiseeManagement/Jiezhang/JieZhang";
import JiaMeng from "../pages/FranchiseeManagement/Franttchisee/JiaMeng";
import Particultext from '../pages/FranchiseeManagement/Jiezhang/JieZhangchakan';
// import ChaKanjiezhang from '../pages/FranchiseeManagement/Jiezhang/JieZhangchakan';
import After from '../pages/AfterSalesMaintenance'
import PindaoAdd from '../pages/ContentManagement/pindaoAdd'
// const lazyLoad = (children)=>{
//     return <Suspense fallback={<>loading...</>}>
//         {children}
//     </Suspense>
// }
const Routers = ()=>{
    return useRoutes([
        {
            path: '/',
            element: <Navigate to={'/login'} />
        },
        {
            path: '/login',
            element: <Login/>
        },
        {
            path: '/home',
            element: <Home/>,
            children: [
                {
                    index: 'index',
                    element: <Shouye/>
                    // element: <Power path={'/home'} ele={<Home/>} />
                },
                {
                    path: 'shouye',
                    element: <Shouye/>
                    // element: <Power path={'/home'} ele={<Home/>} />
                },
                //个人中心
                {
                    path:"person",
                    element: <Person/>
                },
                //频道管理
                {
                    path:"contentPinManagement",
                    element:<PindaoAdd/>
                },
                //作者管理
                {
                    path:"authorManagement",
                    element: <Power path={'/home/authorManagement'} ele={<AuthorManagement/>} />
                },
                //勋章管理
                {
                    path:"medalManagement",
                    element: <Power path={'/home/contentLabelManagement'} ele={<MedalManagement/>} />
                },
                //添加勋章
                {
                    path:"addMedal",
                    // element: lazyLoad(<AddMedal/>)
                    element: <AddMedal/>
                },
                //编辑勋章
                {
                    path:"editMedal",
                    element: <EditMedal/>
                },
                // 内容管理
                {
                    path:"contentManagement",
                    element: <Power path={'/home/contentManagement'} ele={<ContentManagement/>} />
                },
                // 编辑内容
                {
                    path:"editContent",
                    element:<EditContent/>
                },
                //新增内容
                {
                    path:"addContent",
                    element:<AddContent/>
                },
                // 内容标签管理
                {
                    path:"contentLabelManagement",
                    element: <Power path={'/home/contentLabelManagement'} ele={<ContentLabelManagement/>} />
                    // element: <ContentLabelManagement/>
                },
                // 会员管理
                {
                    path: "MemberDetails",
                    element: <MemberDetails/>
                },
                // 添加会员
                {
                    path: "Newhuiyuan",
                    element: <Newhuiyuan/>
                },
                // 会员详情
                {
                    path: "MembershipManagement",
                    // element: lazyLoad(<MembershipManagement/>)
                    element: <Power path={'/home/MembershipManagement'} ele={<MembershipManagement/>} />
                },
                // 会员标签管理
                {
                    path: "MemberLabelManagement",
                    // element: <MemberLabelManagement/>
                    element: <Power path={'/home/MemberLabelManagement'} ele={<MemberLabelManagement/>} />
                },
                // 优惠券管理
                {
                    path: "CouponManagement",
                    element: <Power path={'/home/CouponManagement'} ele={<CouponManagement/>} />
                },
                //优惠券管理新增界面
                {
                    path: "CouponManagement/addCoupon",
                    // element: lazyLoad(<AddCoupon/>)
                    element: <AddCoupon/>
                },
                //优惠券管理编辑界面
                {
                    path: "CouponManagement/editCoupon",
                    // element: lazyLoad(<EditCoupon/>)
                    element: <EditCoupon/>
                },
                // 会员营销
                {
                    path: "HuiManagement",
                    // element: lazyLoad(<MemberMarketing/>)
                    element: <Power path={'/home/HuiManagement'} ele={<MemberMarketing/>} />
                },
                //会员营销查看界面
                {
                    path: "CouponManagement/goDetailM",
                    // element: lazyLoad(<MembershipManagement/>)
                    element: <GoDetailM/>
                },
                //优惠券管理新增界面
                {
                    path: "MemberMarketing/addMarketing",
                    // element: lazyLoad(<EditCoupon/>)
                    element: <AddMarketing/>
                },
                // 订单管理
                {
                    path: "orderManagement",
                    element: <Power path={'/home/orderManagement'} ele={<Order/>} />

                },
                // 订单详情页
                {
                    path: "particulars",
                    element: <Particulars/>
                //    element: lazyLoad(<Particulars/>)
                },
                //加盟商管理
                {
                    path:'SNmanagement',
                    element:<After/>
                },
                // 运营管理
                {
                    path: "operateManagement",
                    // element: <Operate/>
                    element: <Power path={'/home/operateManagement'} ele={<Operate/>} />
                   
                },
                // 商品管理
                {
                    path: "goodsManagement",
                    element: <Power path={'/home/goodsManagement'} ele={<Goods/>} />
                    // element: <Goods/>
                },
                {
                    path:'goodsManagement/addgoods',
                    // element:lazyLoad(<AddGoods/>)
                    element:<AddGoods/>
                },
                {
                    path:'goodsManagement/editgoods',
                    // element:lazyLoad(<EditGoods/>)
                    element:<EditGoods/>
                },
                //商城类目管理
                {
                    path:'mallcategory',
                    // element: lazyLoad(<Mallcategory/>)
                    element: <Power path={'/home/mallcategory'} ele={<Mallcategory/>} />
                },
                // 系统管理
                {
                    path: 'system',
                    // element: <Power path={'/home/system'} ele={<SystemManagement/>} />
                    element: <Power path={'/home/system'} ele={<SystemManagement/>} />
                },
                {
                    path: 'role',
                    element: <Power path={'/home/role'} ele={<RoleManage/>} />
                    // element: <RoleManage/>
                },
                // 创建账户
                {
                    path: 'createAccount',
                    // element: lazyLoad(<CreateAccount/>)
                    element: <CreateAccount/>
                },
                // 修改账号
                {
                    path: 'editAccount',
                    // element: lazyLoad(<EditAccount/>)
                    element: <EditAccount/>
                },
                // 权限配置
                {
                    path: 'power',
                    element: <RolePower/>
                },
                {
                    path:'Jiameng',
                    element:<Power path={'/home/Jiameng'} ele={<JiaMeng/>} />
                },
                {
                    path:'JiaCai',
                    element:<Power path={'/home/JiaCai'} ele={<JieZhang/>} />
                },
                {
                    path:'Particultext',
                    element:<Particultext/>
                },
                {
                    path: '*',
                    element: React.createElement('div',{},'404')
                }
            ]
        },
        
    ])
}
export default Routers;
